Skip to content

Add runit backend to Services tab - #35

Closed
bvdeenen wants to merge 1 commit into
benapetr:masterfrom
bvdeenen:master
Closed

bvdeenen wants to merge 1 commit into
benapetr:masterfrom
bvdeenen:master

Conversation

@bvdeenen

Copy link
Copy Markdown

Based on this reddit conversation I've added runit support (being used in Void linux) to the Services tab. It was mostly a Claude testcase for me, and I found the resulting code very clean.

Feel free to just ignore this PR!!! However if you decide to merge, I'll need to add some information to the readme, because by default on Void, one needs to be root in order to read the statuses of the services. The solution I wrote in the reddit thread I mentioned above.

Auto-detects runit at runtime via /run/runit and sv; queries all services in one sv status call and maps runit states to the existing Service model fields. Systemd remains the primary backend; runit is tried when systemd is absent. No configuration required.

Auto-detects runit at runtime via /run/runit and sv; queries all
services in one sv status call and maps runit states to the existing
Service model fields. Systemd remains the primary backend; runit is
tried when systemd is absent. No configuration required.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@benapetr

Copy link
Copy Markdown
Owner

Hello,

I don't really mind if you used AI for this as long as you understand the change thoroughly and it was well tested. Did you test it? Does it work there?

For me there are 2 problems - I don't know much about runit, I will install void linux into VM to test it out eventually, but unless this was well tested at least by you, then that's a blocker.

Second problem is that it seems to rely on execution of external command. I have that systemctl call as a workaround and actually should probably remove it (by default we use libsystemd.so and direct calls) - executing external commands repeatedly in a loop is problematic and in my opinion unclean design (it also complicates debugging sessions). Does runit provide some other interface? Like some dynamically linked libraries we cloud load instead?

@bvdeenen

Copy link
Copy Markdown
Author

Hi Petr
I did test it on my Void Linux system, and it does respond correctly to runit service changes (via sudo sv start/stop/restart etc...).
I'm going to test it on an Ubuntu VM to check if the systemd interaction still works.

Runit is just interactions with files in /run/runit/supervise.sshd for instance and similarly for /run/runit/supervise-log.sshd. The sv tool and the runsv binary are used to interact with the files (and pipes) in the supervise subdirectories:

Here's an explanation:

  1. Files and directories created/managed by runsv (internal, not edited by the administrator)
    runsv automatically creates and maintains these inside the service directory (and inside ./log/ if logging is enabled):

supervise/ (and log/supervise/)
Contains:
status – binary status file (compatible with daemontools supervise)
stat, pid – human-readable status and PID
control – named pipe for sending commands (sv writes single characters here; you can also printf t > supervise/control etc.)

These are not user-created or user-edited; runsv owns them.
3. Control interface (custom signals)
You can send single-character commands to ./supervise/control (or use sv).
For most characters (except t, s, d), runsv first checks whether a corresponding executable exists under ./control/ (or a custom control program) and runs it before acting. This allows per-service customization of signal handling.

I completely understand your problem! and won't mind at all if you just close this PR. I just want to comment that your codebase is really clean, which is why it was so simple to add the runit interaction.

@bvdeenen

Copy link
Copy Markdown
Author

Petr, thanks for your feedback and the cool tool you made.

It's too much work for you to maintain this capability, on a system that you don't use, and most of the Void users are hard-core command line junkies anyway :-)
If I find the Void community in desperate need of this tool, I'll just keep a downstream fork of your codebase with the runit stuff added.

So I'm withdrawing the PR.

Greetings.

@bvdeenen bvdeenen closed this Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants